package com.shengyin.ec.model.dao.account;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.shengyin.ec.model.dao.BaseDao;
import com.shengyin.ec.model.dao.BaseDaoImpl;
import com.shengyin.ec.model.entity.BookInfo;

@Repository("bookInfoDao")
public class BookInfoDaoImpl extends BaseDaoImpl<BookInfo> implements BookInfoDao {
	
	@Override
	public List<BookInfo> getBookInfoListById(long id){
		List<BookInfo> bookInfoList = super.find("from BookInfo where userId='"+id+"'");
		
		return bookInfoList;
	}
	
	@Override
	public List<BookInfo> getBookInfoListByKeywords(String keyword){
		keyword = "%" + keyword + "%";
		List<BookInfo> bookInfoList = super.find("from BookInfo where bookItem like '"+keyword+"'");
		System.out.print("------------------------------------"+keyword);
		System.out.print("------------------------------------"+bookInfoList.size());
		
		return bookInfoList;
	}
	
	@Override
	public List<BookInfo> getBookInfoListByStatus(long id){
		List<BookInfo> bookInfoList = super.find("from BookInfo where userId='"+id+"' order by processStatus");
		return bookInfoList;
	}
	@Override
	public List<BookInfo> getBookInfoListByBookItem(long id){
		List<BookInfo> bookInfoList = super.find("from BookInfo where userId='"+id+"' order by bookItem");
		return bookInfoList;
	}
}